﻿@model Nop.Admin.Models.WindAlert.SpotModel

@Html.ValidationSummary(false)
@Html.HiddenFor(model => model.Id)


<div id="spot-edit">
    <ul>
        <li @Html.RenderSelectedTabIndex(0, GetSelectedTabIndex())>
            @T("Admin.WindAlert.Spots.Info")
        </li>
        <li @Html.RenderSelectedTabIndex(1, GetSelectedTabIndex())>
            @T("Admin.Common.SEO")
        </li>
        <li @Html.RenderSelectedTabIndex(2, GetSelectedTabIndex())>
            @T("Admin.WindAlert.Spots.Station")
        </li>
        <li @Html.RenderSelectedTabIndex(3, GetSelectedTabIndex())>
            @T("Admin.WindAlert.Spots.Wave")
        </li>
        <li @Html.RenderSelectedTabIndex(4, GetSelectedTabIndex())>
            @T("Admin.WindAlert.Spots.WaveForecast")
        </li>
        <li @Html.RenderSelectedTabIndex(5, GetSelectedTabIndex())>
            @T("Admin.WindAlert.Spots.Cameras")
        </li>
    </ul>
    <div>
        @TabInfo()
    </div>
    <div>
        @TabSeo()
    </div>
    <div>
        @TabStation()
    </div>
    <div>
        @TabWave()
    </div>
    <div>
        @TabWaveForecast()
    </div>
    <div>
        @TabCameras()
    </div>
</div>
<script>
    $(document).ready(function () {
        $("#spot-edit").kendoTabStrip({
            animation: {
                open: {
                    effects: "fadeIn"
                }
            },
            select: tabstrip_on_tab_select
        });
    });
</script>

@{
    //custom tabs
    var eventMessage = new AdminTabStripCreated(this.Html, "spot-edit");
    EngineContext.Current.Resolve<IEventPublisher>().Publish(eventMessage);
    foreach (var eventBlock in eventMessage.BlocksToRender)
    {
        @eventBlock
    }
}

    @*save selected tab index*@
	<input type="hidden" id="selected-tab-index" name="selected-tab-index" value="@(GetSelectedTabIndex())">

@helper TabInfo()
    { 
        <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.ShowOnHome):
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.ShowOnHome)
                @Html.ValidationMessageFor(model => model.ShowOnHome)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.ShowOnAviasion):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.ShowOnAviasion)
                @Html.ValidationMessageFor(model => model.ShowOnAviasion)
            </td>
        </tr> 
       
    </table>
    @(Html.LocalizedEditor<Nop.Admin.Models.WindAlert.SpotModel, Nop.Admin.Models.WindAlert.SpotLocalizedModel>("sopt-info-localized",
                @<table class="adminContent">
                    <tr>
                        <td class="adminTitle">
                            @Html.NopLabelFor(model => model.Locales[item].Name):
                        </td>
                        <td class="adminData">
                            @Html.EditorFor(model => Model.Locales[item].Name)
                            @Html.ValidationMessageFor(model => model.Locales[item].Name)
                        </td>
                    </tr>
                    <tr>
                        <td class="adminTitle">
                            @Html.NopLabelFor(model => model.Locales[item].Description):
                        </td>
                        <td class="adminData">
                            @Html.EditorFor(model => model.Locales[item].Description, "RichEditor")
                            @Html.ValidationMessageFor(model => model.Locales[item].Description)
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            @Html.HiddenFor(model => model.Locales[item].LanguageId)
                        </td>
                    </tr>
                </table>
                ,
                @<table class="adminContent">
                    <tr>
                        <td class="adminTitle">
                            @Html.NopLabelFor(model => model.Name):
                        </td>
                        <td class="adminData">
                            @Html.EditorFor(model => model.Name)
                            @Html.ValidationMessageFor(model => model.Name)
                        </td>
                    </tr>
                    <tr>
                        <td class="adminTitle">
                            @Html.NopLabelFor(model => model.Description):
                        </td>
                        <td class="adminData">
                            @Html.EditorFor(x => x.Description, "RichEditor")
                            @Html.ValidationMessageFor(model => model.Description)
                        </td>
                    </tr>
                </table>
            ))
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.Published):
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.Published)
                @Html.ValidationMessageFor(model => model.Published)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.DisplayOrder):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.DisplayOrder)
                @Html.ValidationMessageFor(model => model.DisplayOrder)
            </td>
        </tr> 
       
    </table>
}

@helper TabSeo()
    {
    @(Html.LocalizedEditor<Nop.Admin.Models.WindAlert.SpotModel, Nop.Admin.Models.WindAlert.SpotLocalizedModel>("spots-seo-localized",
               @<table class="adminContent">
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.Locales[item].MetaKeywords):
                       </td>
                       <td class="adminData">
                           @Html.EditorFor(model => model.Locales[item].MetaKeywords)
                           @Html.ValidationMessageFor(model => model.Locales[item].MetaKeywords)
                       </td>
                   </tr>
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.Locales[item].MetaDescription):
                       </td>
                       <td class="adminData">
                           @Html.TextAreaFor(model => model.Locales[item].MetaDescription)
                           @Html.ValidationMessageFor(model => model.Locales[item].MetaDescription)
                       </td>
                   </tr>
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.Locales[item].MetaTitle):
                       </td>
                       <td class="adminData">
                           @Html.TextAreaFor(model => model.Locales[item].MetaTitle)
                           @Html.ValidationMessageFor(model => model.Locales[item].MetaTitle)
                       </td>
                   </tr>
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.Locales[item].SeName):
                       </td>
                       <td class="adminData">
                           @Html.TextAreaFor(model => model.Locales[item].SeName)
                           @Html.ValidationMessageFor(model => model.Locales[item].SeName)
                       </td>
                   </tr>
                   <tr>
                       <td colspan="2">
                           @Html.HiddenFor(model => model.Locales[item].LanguageId)
                       </td>
                   </tr>
               </table>
               ,
               @<table class="adminContent">
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.MetaKeywords):
                       </td>
                       <td class="adminData">
                           @Html.EditorFor(x => x.MetaKeywords)
                           @Html.ValidationMessageFor(model => model.MetaKeywords)
                       </td>
                   </tr>
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.MetaDescription):
                       </td>
                       <td class="adminData">
                           @Html.TextAreaFor(x => x.MetaDescription)
                           @Html.ValidationMessageFor(model => model.MetaDescription)
                       </td>
                   </tr>
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.MetaTitle):
                       </td>
                       <td class="adminData">
                           @Html.TextAreaFor(x => x.MetaTitle)
                           @Html.ValidationMessageFor(model => model.MetaTitle)
                       </td>
                   </tr>
                   <tr>
                       <td class="adminTitle">
                           @Html.NopLabelFor(model => model.SeName):
                       </td>
                       <td class="adminData">
                           @Html.TextAreaFor(x => x.SeName)
                           @Html.ValidationMessageFor(model => model.SeName)
                       </td>
                   </tr>
               </table>)) 
    
}

@helper TabStation()
{
   <table class="adminContent">
       <tr>
           <td class="adminTitle">
               @Html.NopLabelFor(model => model.IsStation):
           </td>
           <td class="adminData">
               @Html.EditorFor(x => x.IsStation)
               @Html.ValidationMessageFor(model => model.IsStation)
           </td>
       </tr>
       <tr>
           <td class="adminTitle">
               @Html.NopLabelFor(model => model.StationAdjustTime):
           </td>
           <td class="adminData">
               @Html.EditorFor(x => x.StationAdjustTime)
               @Html.ValidationMessageFor(model => model.StationAdjustTime)
           </td>
       </tr>
       <tr>
           <td class="adminTitle">
               @Html.NopLabelFor(model => model.StationDataUrl):
           </td>
           <td class="adminData">
               @Html.EditorFor(model => model.StationDataUrl)
               @Html.ValidationMessageFor(model => model.StationDataUrl)
               @if (!string.IsNullOrEmpty(Model.StationDataUrl))
               {
                   <span style="margin-left:20px"><a href="@Model.StationDataUrl" target="_blank">View Link</a></span>
               }
           </td>
       </tr>
       <tr>
           <td class="adminTitle">
               @Html.NopLabelFor(model => model.StationSplitMethod):
           </td>
           <td class="adminData">
               @Html.EditorFor(model => model.StationSplitMethod)
               @Html.ValidationMessageFor(model => model.StationSplitMethod)
           </td>
       </tr>
       <tr>
           <td class="adminTitle">
               @Html.NopLabelFor(model => model.StationIsMetar):
           </td>
           <td class="adminData">
               @Html.EditorFor(model => model.StationIsMetar)
               @Html.ValidationMessageFor(model => model.StationIsMetar)
           </td>
       </tr>
   </table>
}
@helper TabWave()
{
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.IsWave):
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.IsWave)
                @Html.ValidationMessageFor(model => model.IsWave)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.WaveAdjustTime):
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.WaveAdjustTime)
                @Html.ValidationMessageFor(model => model.WaveAdjustTime)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.WaveDataUrl):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.WaveDataUrl)
                @Html.ValidationMessageFor(model => model.WaveDataUrl)
                @if (!string.IsNullOrEmpty(Model.WaveDataUrl))
                {
                    <span style="margin-left:20px"><a href="@Model.WaveDataUrl" target="_blank">View Link</a></span>
                }
            </td>
        </tr>

    </table>
}
@helper TabWaveForecast()
{
    <table class="adminContent">
     <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.lat):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.lat)
                @Html.ValidationMessageFor(model => model.lat)
            </td>
        </tr> 
         <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.lng):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.lng)
                @Html.ValidationMessageFor(model => model.lng)
            </td>
        </tr> 
         <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.IsForecast):
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.IsForecast)
                @Html.ValidationMessageFor(model => model.IsForecast)
            </td>
        </tr>
        </table>
}

@helper TabCameras()
{
    if (Model.AvailableCameras != null && Model.AvailableCameras.Count > 0)
    {
        foreach (var camera in Model.AvailableCameras)
        {
            <input type="checkbox" name="SelectedCameraIds" value="@camera.Id"
                   @if (Model.SelectedCameraIds != null && Model.SelectedCameraIds.Contains(camera.Id)) { <text> checked="checked" </text>   } />@camera.Name
                <br />
        }
    }
    else
    {
        @T("Admin.Windalert.spots.Fields.CameraNoRoles")
    }
}